<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ajax无刷新分页效果</title>
    <script type="text/javascript">
        function showpage(url){
            var xhr = new XMLHttpRequest();

            xhr.onreadystatechange = function(){
                if(xhr.readyState == 4){
                   document.getElementById('result').innerHTML = xhr.responseText;
                }
            }

            xhr.open('get', url);
            xhr.send(null);
        }
        window.onload = function(){
            showpage('04AjaxPage.php');
        }
    </script>
    <style>
        h2, div{
            width: 900px;
            margin: auto;
        }
        h2{
            text-align: center;
        }
    </style>
</head>
<body>
    <h2>Ajax无刷新分页效果</h2>
    <div id="result"></div>
</body>
</html>